home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / monitor / clrline.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  882 b   |  47 lines

  1. # include    "monitor.h"
  2. # include    <ingres.h>
  3. # include    <aux.h>
  4. # include    <sccs.h>
  5.  
  6. SCCSID(@(#)clrline.c    8.1    12/31/84)
  7.  
  8.  
  9.  
  10. /*
  11. **  Clear Input Line
  12. **
  13. **    This routine removes the newline following a monitor command
  14. **    (such as \t, \g,  etc.)  Any other characters are processed.
  15. **    Hence, \t\g\t will work.  It also maintains the
  16. **    Newline flag on command lines.  It will make certain that
  17. **    the current line in the query buffer ends with a newline.
  18. **
  19. **    The flag 'noprompt' if will disable the prompt character if set.
  20. **    Otherwise, it is automatically printed out.
  21. **
  22. **    Uses trace flag 8
  23. */
  24.  
  25. clrline(noprompt)
  26. int    noprompt;
  27. {
  28.     register char    c;
  29.  
  30.     if (!Newline)
  31.         putc('\n', Qryiop);
  32.     Newline = TRUE;
  33.     /* if char following is a newline, throw it away */
  34.     c = getch();
  35.     Prompt = c == '\n';
  36.     if (!Prompt)
  37.     {
  38.         ungetc(c, Input);
  39.     }
  40.     else
  41.     {
  42.         if (!noprompt)
  43.             prompt(0);
  44.     }
  45.     return;
  46. }
  47.